<template>
  <div class="caontiner">
    <div class="nav">
      <div class="navList">
        <div  :class='active==index ?"active":""' v-for="(temp,index) in array" :key="index" @click=" routerLink(temp.href,index)">{{temp.name}}</div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  computed: {
    active() {
      return this.$store.state.header_active;
    }
  },
  data() {
    return {
      array: [
        {
          name: "互动H5",
          href: "interact"
        },
        {
          name: "长图简漫",
          href: "longPic"
        },
        {
          name: "创意海报",
          href: "poster"
        },
        {
          name: "创意视频",
          href: "video"
        }
      ]
    };
  },
  methods: {
    routerLink(name, index) {
      if (this.active == index) {
        return;
      }
      // this.$store.commit("SETTING_HEADER_ACTIVE1", index);
      this.$router.push({ name });
    }
  }
};
</script>
<style lang="less">
.caontiner {
  width: 100%;
  display: flex;
  justify-content: space-between;
  .nav {
    width: 100%;
    padding: 20px;
    box-sizing: border-box;
    margin: 0 auto;
    background: #ffffff;
    display: flex;
    justify-content: space-between;
    .navList {
      display: flex;
      width: 100%;
      justify-content: space-between;
     }
    }
  }
   .active {
      color: #e44f50 !important; 
      position: relative;
      &::after {
        content: "";
        display: block;
        position: absolute;
        bottom: 0;
        left: 50%;
        transform: translateX(-50%);
        border: 1px solid #e44f50;
        width: 50px;
      }
}
</style>